#ifndef INPUTVALIDATOR_H
#define INPUTVALIDATOR_H
#include <QLineEdit>
#include <QVector>
class InputValidator : public QObject {
    Q_OBJECT
public:
    explicit InputValidator(QObject *parent = nullptr);
    void registerLineEdit(QLineEdit *edit); // 注册需验证的输入框

protected:
    bool eventFilter(QObject *obj, QEvent *event) override;

private:
    QVector<QLineEdit*> m_managedEdits; // 存储管理的输入框
    bool validateInput(QLineEdit *edit, const QKeyEvent *keyEvent);
};

#endif // INPUTVALIDATOR_H
